CHAPTER 11 Comparing Average Values between Groups 157

Sometimes you may not know which post-hoc test to select for your ANOVA. If

you have an advisor or you are on a research team, you should discuss which one

is best. However, if you run the one you select and do not trust the results, it’s not

a bad idea to run the other ones and keep track of the results. The p values will

always come out different, but if the interpretation changes — meaning different

comparisons are statistically significant, depending upon what test you choose —

you may want to rethink doing post-hoc tests. This means that the results you are

getting are unstable.

Running nonparametric tests

As a reminder, the Wilcoxon Sum-of-Ranks test is the nonparametric alternative

to the t test, which you can use if your data do not follow a normal distribution.

Like with the t test, you can run a Wilcoxon Sum-of-Ranks test in R with options

that gives you results if you are doing a paired t test. But to simply repeat the

independent t test we did earlier comparing mean fasting glucose in married

NHANES participants compared to all other marital statuses, you would run this

code: wilcox.test(NHANES$LBXGLU ~ NHANES$MARRIED).

The Kruskal-Wallis test is a nonparametric ANOVA alternative. Like the ANOVA,

you can use the Kruskal-Wallis to test whether the mean fasting glucose is equal

in the three-level marital status variable MARITAL. The R code for the Kruskal-

Wallis test is different from the ANOVA code because it does not require you to

produce an object for the summary statistics. The following code prints the results

to the output: kruskal.test(LBXGLU ~ MARITAL, data = NHANES).

Nonparametric tests don’t compare group means or test for a nonzero mean dif-

ference. Rather, they compare group medians, or they deal with ranking the order

of variables and analyze those ranks. Because it this, the output from R and other

programs will likely focus on reporting the p value of the test.

Only use a nonparametric test if you are absolutely sure your data do not qualify

for a parametric test (meaning t test, ANOVA, and others that require a particular

distribution). Parametric tests are more powerful. In the NHANES example, the

data would qualify for a parametric test; we only showed you the code for non-

parametric tests as an example.